package es.battleship.model;

import java.util.List;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

import com.google.appengine.api.datastore.Key;

@XmlRootElement
@PersistenceCapable
public class GameConfig {
	@PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Key id;
	
	@Persistent
	private int dimensionX;
	@Persistent
	private int dimensionY;
	
	@Persistent(defaultFetchGroup = "true")
	private List<ShipConfig> shipConfigs;
	
	public GameConfig() {
		super();
	}

	@XmlTransient
	public Key getId() {
		return id;
	}

	public void setId(Key id) {
		this.id = id;
	}

	public int getDimensionX() {
		return dimensionX;
	}

	public void setDimensionX(int dimensionX) {
		this.dimensionX = dimensionX;
	}

	public int getDimensionY() {
		return dimensionY;
	}

	public void setDimensionY(int dimensionY) {
		this.dimensionY = dimensionY;
	}

	public List<ShipConfig> getShipConfigs() {
		return shipConfigs;
	}

	public void setShipConfigs(List<ShipConfig> shipConfigs) {
		this.shipConfigs = shipConfigs;
	}
	
	public String toString() {
		return "GameConfig { Id: " + id 
				+" dimensionX: " 
				+ dimensionX 
				+ " dimensionY: " 
				+ dimensionY 
				+ " shipConfigs: " 
				+ shipConfigs 
				+ " }"; 
	}
}
